/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package vadung.contragame2d;

import java.io.IOException;
import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;

/**
 *
 * @author dung.voanh
 */
public class StateLogo extends State{
    private Image m_imgLogo;
    // Time draw Logo
    private long m_lTimeStartLogoGame;

    public StateLogo() { 
    }
        
    public void Init() {
        m_lTimeStartLogoGame = System.currentTimeMillis();   
        m_imgLogo = ResourceManager.GetInstance().GetImage(0);
    }   

    public void Update() {        
        if(Midlet.s_canGame.GetGameTimeLastUpdate() - m_lTimeStartLogoGame >= 3000){            
            System.out.println("Image logo is timeout display.");
            Midlet.s_canGame.SwitchState(DEFINE.STATE_SPLASH);                
        }
    }
  
    public void Render(Graphics g) {
        int x = Midlet.s_canGame.getWidth()/2;
        int y = Midlet.s_canGame.getHeight()/2;
        g.drawImage(m_imgLogo, x, y, Graphics.HCENTER | Graphics.VCENTER);
    }
    
    public void Exit() {
        m_imgLogo = null;
    }
}
